﻿IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[usp_addcol]') AND type in (N'P', N'PC'))
DROP PROCEDURE [usp_addcol]
go
create procedure [usp_addcol](@tblName varchar(100), @fldName varchar(100),@dtype varchar(100))
AS
begin
declare @ret int
set @ret = 0
if exists(select * from syscolumns where lower(name)=lower(@fldName) 
	and lower(object_name(id)) = lower(@tblName))
	
set @ret=1

if @ret=0
	begin
	--print 'adding field'
	exec('ALTER TABLE '+@tblName+' add '+@fldName+' '+@dtype)
	end

end
go
usp_addcol 'claims','Priviledged','decimal(10,2)'
go
